package com.jz.community.moduleshopping.shopCart.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jz.community.basecomm.utils.CharacterUtils;
import com.jz.community.basecomm.utils.ConverterUtils;
import com.jz.community.moduleshopping.R;
import com.jz.community.moduleshopping.shopCart.bean.CartGoodInfo;

import java.util.List;

/**
 * Created by Tony.Fan on 2018/5/21 14:17
 */
public class ShopCartBalanceAdapter extends BaseQuickAdapter<CartGoodInfo, BaseViewHolder> {

    public ShopCartBalanceAdapter(int layoutResId, @Nullable List<CartGoodInfo> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CartGoodInfo item) {
        helper.setText(R.id.shop_name, item.getGoodsName());
        helper.setText(R.id.balance_num, "共" + item.getNum() + "件");
        helper.setText(R.id.balance_price, "¥" + CharacterUtils.roundByGoodPrice(ConverterUtils.toDouble(item.getPrice())));
        helper.addOnClickListener(R.id.balance_tv);
    }
}
